import { axios } from '@/utils/request'

// post
export function postAction (url, parameter, timeOut) {
  return axios({
    url: url,
    method: 'post',
    data: parameter,
    timeout: timeOut === undefined ? 6000 : timeOut
  })
}

// put
export function putAction (url, parameter, timeOut) {
  return axios({
    url: url,
    method: 'put',
    data: parameter,
    timeout: timeOut === undefined ? 6000 : timeOut
  })
}

// get
export function getAction (url, parameter, timeOut) {
  return axios({
    url: url,
    method: 'get',
    params: parameter,
    timeout: timeOut === undefined ? 6000 : timeOut
  })
}

// deleteAction
export function deleteAction (url, parameter, timeOut) {
  return axios({
    url: url,
    method: 'delete',
    params: parameter,
    timeout: timeOut === undefined ? 6000 : timeOut
  })
}

// fileAction
export function fileAction (url, parameter) {
  return axios({
    method: 'post',
    url: url,
    data: parameter,
    responseType: 'blob',
    timeout: 0
  })
}

// fileImportAction
export function fileImportAction (url, parameter) {
  return axios({
    method: 'post',
    url: url,
    params: parameter,
    timeout: 0
  })
}
